package com.guoxue.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.guoxue.dao.IOrderDao;
import com.guoxue.domain.OrderVo;
@Repository
public class OrderDaoImpl extends BaseDaoImpl<OrderVo> implements IOrderDao{

	@Override
	public void saveOrder(OrderVo order) {
		saveOrUpdate(order);
	}

	@Override
	public List<OrderVo> getOrderList(Integer uid) {
		return find("FROM OrderVo o WHERE o.uid= ? AND o.sysflag = 0", new Object[] {uid});
	}

	@Override
	public Long getOrderTotal(int uid) {
		return count("SELECT count(*) FROM OrderVo o WHERE o.uid = ? AND o.sysflag = 0",new Object[] {uid});
	}

	@Override
	public OrderVo getOrder(int id,int uid) {
		return get("FROM OrderVo o WHERE o.id = ? AND o.sysflag = 0", new Object[] {id,uid});
	}

}
